<template>
  <div>
    <!-- 导航栏 -->
    <van-nav-bar title="文章详情" left-arrow @click-left="$router.back()" />
    <!-- 文章作者 -->
    <h2>{{ info.title }}</h2>
    <div class="userPic">
      <van-image fit="cover" round :src="info.aut_photo" />
      <div class="userName">
        <div>{{ info.aut_name }}</div>
        <span>{{ info.pubdate | relvTime }}</span>
      </div>
      <van-button icon="plus" type="primary" round color="#1989fa"
        >按钮</van-button
      >
    </div>
    <!-- 文章内容 -->
    <!-- <div class="content" v-html="info.content">
      {{ info.content }}
    </div> -->
    <!-- end分割线 -->
    <div>
      <van-divider>end</van-divider>
    </div>
    <!-- 点赞-不喜欢 -->
    <div class="xh">
      <van-button icon="good-job-o" plain round color="#07c160">
        点赞
      </van-button>
      <van-button icon="delete" plain round color="#ee0a24">
        不喜欢
      </van-button>
    </div>
    <!-- 导入comment组件 -->
    <comment />
  </div>
</template>

<script>
import { particularsInfoAPI } from "@/api";
import comment from "./comment.vue";

export default {
  components: {
    comment,
  },
  data() {
    return {
      info: {},
    };
  },
  async created() {
    let res = await particularsInfoAPI(this.$route.query.id);
    this.info = res.data.data;
    // console.log(this.info);
  },
};
</script>

<style lang="less" scoped>
h2 {
  margin: 10px 10px;
  font-size: 20px;
}
.userPic {
  display: flex;
  align-items: center;
  margin: 10px 10px;
  ::v-deep .van-image {
    margin-right: 20px;
    width: 80px;
    height: 80px;
  }
  .userName {
    flex: 1;
    span {
      color: #ddd;
    }
  }
}

.content {
  margin: 0px 10px;
  overflow: auto;
  ::v-deep pre {
    overflow: auto;
    background-color: #000;
    color: #fff;
  }
}

.xh {
  display: flex;
  justify-content: space-around;
  .van-button {
    width: 100px;
  }
}
</style>
